package com.ttedu.database.service.Impl;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.springframework.stereotype.Service;

import com.ttedu.database.model.itemschaptertips;
import com.ttedu.database.service.ItemsChaptertipsService;
import com.ttedu.util.Validator;
@Service
public class ItemsChaptertipsServiceImpl implements ItemsChaptertipsService{
	//批量添加题目与题库关系
	public void addBatchItemsChaptertips(String chaptertipstree,int itemId){
		List<itemschaptertips> list=new ArrayList<itemschaptertips>();
		if(Validator.isNotNull(chaptertipstree)){
			String[] strtree=chaptertipstree.split(",");
			for(int i=0;i<strtree.length;i++){
				itemschaptertips ites=new itemschaptertips();
				ites.setChaptertipId(Integer.valueOf(strtree[i]));
				ites.setItemId(itemId);
				ites.setCreatedAt(new Date());
				ites.setUpdatedAt(new Date());
				list.add(ites);
			}//end for
			//执行SQL
			
		}//end if
	}
}
